//
//  MeAboutViewController.m
//  QT
//
//  Created by 甘世清 on 2025/1/3.
//

#import "MeAboutViewController.h"

@interface MeAboutViewController ()

@property (nonatomic , strong) UILabel * number;
@end

@implementation MeAboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.zx_hideBaseNavBar = YES;
}
- (void)SQ_UIViewForSelfView{
    UIView * bgView = [[UIView alloc]init];
    bgView .backgroundColor = SQColorF1F1F1;
    bgView.layer.masksToBounds = YES;
    bgView.layer.cornerRadius = 20;
    [self.view addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(SCREEN_WIDETH-30);
        make.top.equalTo(self.view).offset(20);
        make.centerX.equalTo(self.view);
        make.height.mas_equalTo(200);
    }];
    [bgView addSubview:self.fsTextView];
    [self.fsTextView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(bgView).insets(UIEdgeInsetsMake(10, 10, 10, 10));
    }];
    self.number = [[UILabel alloc]init];
    self.number.textColor =  SQColor999999;
    self.number.font = FONT_MEDIUM(12);
    [self.view addSubview:self.number];
    [self.number mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(bgView.mas_right).offset(-10);
        make.bottom.equalTo(bgView.mas_bottom).offset(-10);
    }];
    self.number.text = @"(0/200)";
    WS(weakSelf);
    [self.fsTextView addTextDidChangeHandler:^(FSTextView *textView) {
        weakSelf.number.text = [NSString stringWithFormat:@"%lu/200",(unsigned long)textView.text.length];
        weakSelf.number.keywords = [NSString stringWithFormat:@"%lu/",(unsigned long)textView.text.length];;
        weakSelf.number.keywordsColor = UIColor.whiteColor;
        [weakSelf.number getLableSizeWithMaxWidth:200];
    }];
    
    
    
    [self.view addSubview:self.reloadBtn];
    [self.reloadBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.view);
            make.height.mas_equalTo(50);
            make.width.mas_equalTo(SCREEN_WIDETH-60);
        make.bottom.equalTo(self.view.mas_bottom).offset(-FootHeight-20);
    }];
   
    [self.reloadBtn setTouchBlock:^(SQCustomButton * _Nonnull button) {
        if (weakSelf.btntouchBlock) {
            weakSelf.btntouchBlock();
        }
    }];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}
- (SQCustomButton *)reloadBtn{
    if (!_reloadBtn) {
        _reloadBtn = [[SQCustomButton alloc]initType:SQCustomButtonLeftImageType imageSize:CGSizeMake(0, 0) midmargin:10];
        _reloadBtn.text = SQNSLocalString(@"提交");
        _reloadBtn.image = SQGetImage(@"xiayige");
        _reloadBtn.font = FONT_MEDIUM(14);
        _reloadBtn.textColor = UIColor.whiteColor;
        _reloadBtn.layer.cornerRadius = 10;
        _reloadBtn.layer.borderColor = SQColor333333.CGColor;
        _reloadBtn.layer.borderWidth = 0.5;
        _reloadBtn.backgroundColor = SQColorDA70D6;
    }
    return _reloadBtn;
}

-(FSTextView*)fsTextView{
    if (!_fsTextView) {
        _fsTextView = [FSTextView textView];
        _fsTextView.font = FONT_MEDIUM(14);
        _fsTextView.textColor = SQColor333333;
        _fsTextView.placeholder =SQNSLocalString(@"简单的做个自我描述吧～");
        _fsTextView.placeholderColor = SQColor999999;
        _fsTextView.backgroundColor = UIColor.clearColor;
        _fsTextView.maxLength = 200;
       
    }
    return _fsTextView;
}
@end
